package com.example.clxy.controller;

import com.example.clxy.entity.Adjustschedule;
import com.example.clxy.interceptor.AppToken;
import com.example.clxy.result.PageResult;
import com.example.clxy.result.StandardResult;
import com.example.clxy.result.WebRestResult;
import com.example.clxy.result.business.PageResult.AdjustSchedulePageResult;
import com.example.clxy.result.business.PageResult.WorkableAdjustSchedulePageResult;
import com.example.clxy.service.AdjustScheduleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author weichong
 * date 2020-08-05
 * @Description:
 */
@AppToken
@RestController
@RequestMapping("AdjustScheduleController")
public class AdjustScheduleController {

    @Autowired
    private AdjustScheduleService adjustScheduleService;

    /**
     * 新增调课
     */
    @RequestMapping("addAdjustSchedule")
    public WebRestResult addAdjustSchedule(@RequestBody Adjustschedule adjustschedule){
        WebRestResult res = adjustScheduleService.addAdjustSchedule(adjustschedule);
        return res;
    }

    /**
     * 查询调课申请
     */
    @RequestMapping("getAdjustSchedule")
    public PageResult<AdjustSchedulePageResult> getAdjustSchedule(String teacherid,String studentid, String adjuststate, int page, int pagesize){
        PageResult<AdjustSchedulePageResult> res = adjustScheduleService.getAdjustSchedule(teacherid,studentid,adjuststate,page,pagesize);
        return res;
    }

    /**
     * 查询调课申请
     */
    @RequestMapping("getAdjustByScheduleid")
    public StandardResult getAdjustByScheduleid(String adjustclassid){
        StandardResult res = adjustScheduleService.getAdjustByScheduleid(adjustclassid);
        return res;
    }

    /**
     * 获取可调课班级信息
     */
    @RequestMapping("getWorkableAdjustSchedule")
    public PageResult<WorkableAdjustSchedulePageResult> getWorkableAdjustSchedule(String scheduleid, int page, int pagesize) {
        PageResult<WorkableAdjustSchedulePageResult> res = adjustScheduleService.getWorkableAdjustSchedule(scheduleid, page, pagesize);
        return res;
    }

    @RequestMapping("updateAdjustSchedule")
    public WebRestResult updateAdjustSchedule(@RequestBody Adjustschedule adjustschedule){
        WebRestResult res = adjustScheduleService.updateAdjustSchedule(adjustschedule);
        return res;
    }


}
